package com.example.spring_rabbit.constum;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author wangc
 * @date 2022/8/26 16:13
 */
@Component
public class topicustomer {


    //bindings 绑定
    @RabbitListener(bindings = {
            @QueueBinding(
                    value = @Queue,//创建临时队列
                    exchange = @Exchange(value = "topic_logs", type = "topic"),//连接交换机 和指定模式
                    key = {"user.save", "user.#"}
            )
    })
    public void re2(String mes) {
        System.out.println("topic_logs2" + mes);
    }

    //bindings 绑定
    @RabbitListener(bindings = {
            @QueueBinding(
                    value = @Queue,//创建临时队列
                    exchange = @Exchange(value = "topic_logs", type = "topic"),//连接交换机 和指定模式
                    key = {"user.save", "user.*"}
            )
    })
    public void re1(String mes) {
        System.out.println("topic_logs1" + mes);
    }


}
